<template>
  <rx-dialog @handOk="handOk" @cancel="cancel">
    <rx-layout>
      <div slot="header"  >
        <div class="table-page-search-wrapper">
          <a-form layout="inline">
            <a-row :gutter="48">
              <a-col :md="5" :sm="15">
                <a-form-item :label="$ti18('rxForm.name','名称')">
                  <a-input :placeholder="$ti18('rxForm.name','名称','','input')" v-model="queryParam.Q_NAME__S_LK" />
                </a-form-item>
              </a-col>

              <a-col :md="5" :sm="15">
                <a-form-item :label="$ti18('rxForm.rxAlias','别名')">
                  <a-input :placeholder="$ti18('rxForm.rxAlias','别名','','input')" v-model="queryParam.Q_ALIAS__S_LK" />
                </a-form-item>
              </a-col>

              <a-col :md="8" :sm="24">
              <span class="table-page-search-submitButtons">
                <a-button type="primary" @click="$refs.table.refresh(true)" icon="search">{{$ti18('rxList.searchBtn','查询')}}</a-button>
                <a-button style="margin-left: 4px" @click="resetSearch">{{$ti18('rxList.resetBtn','重置')}}</a-button>

              </span>
              </a-col>
            </a-row>
          </a-form>
        </div>
      </div>

      <div slot="center" style>
        <s-table
          size="default"
          ref="table"
          rowKey="id"
          bordered="true"
          :rowSelection="{selectedRowKeys: selectedRowKeys,type:'radio', onChange: onSelectChange}"
          :columns="columns"
          :data="loadData"
        >
          <span slot="serial" slot-scope="text,record,index">{{ index + 1 }}</span>

          <span slot="status" slot-scope="text,record,index" v-html="formatStyle(text,status)">
        </span>
        </s-table>

      </div>
    </rx-layout>
  </rx-dialog>
</template>

<script>
  import { BaseList, RxLayout,Util } from "@lowcode/jpaas-common-lib"
  import FormBoDefApi from "@/api/form/bo/formBoDef";

  export default {
    name: 'form-bodef-dialog',
    mixins: [BaseList],
    components: {
      RxLayout
    },
    props:{
      layerid: {
        type: String,
        default: ""
      },
      destroy: {
        type: Function
      }
    },
    data() {
      return {
        columns: [
          { title: '#', scopedSlots: { customRender: 'serial' }, width: 30 },
          { title: this.$ti18('rxForm.name','名称'), dataIndex: 'name', width: 100},
          { title: this.$ti18('rxForm.rxAlias','别名'), dataIndex: 'alias', width: 100 },
          { title: this.i18n('form.supDB','支持数据库'), dataIndex: 'supportDb', width: 100,scopedSlots: { customRender: 'status' }},
          { title: this.i18n('form.genType','生成类型'), dataIndex: 'genType', width: 100},
        ],
        status:[{key:1,text:this.i18n('map.publish','发布'),css:'green'},{key:0,text:this.i18n('map.unpublished','未发布'),css:'red'}]
      }

    },
    created() {
        this.needFilterAppId();
      },
    methods: {
      i18n(name,text,key){
          return this.$ti18(name,text,"formBoDef",key);
      },
      getListByParams(parameter) {
        return FormBoDefApi.query(parameter)
      },
      getForm(){
        var row=this.selectedRows[0];
        return row;
      },
      cancel(){
        Util.closeWindow(this,"cancel");
      },
      handOk(){
        var rows=this.selectedRows;
        if(rows.length==0){
          this.$message.warning(this.$ti18("rxMsa.masWarn.selectOneRecord","请选择一行记录!"));
          return;
        }
        Util.closeWindow(this,"ok");
      }
    }
  }
</script>
<style  scoped >

</style>

